package com.xyc.task.service;

import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
// 异步任务
public class AsyncService {

    @Async // 使用异步注解
    public void asy() {
        try {
            Thread.sleep(3000);
        } catch (Exception e) {
            e.printStackTrace();
        }
        System.out.println("处理数据中");
    }
}
